package com.testdocs.client.structure.general;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

public class GeneralPanelsImpl extends Composite implements GeneralPanels {
	@UiTemplate("GeneralPanels.ui.xml")
	interface GeneralPanelsUiBinder extends UiBinder<Widget, GeneralPanelsImpl> {
	}

	private static GeneralPanelsUiBinder uiBinder = GWT
			.create(GeneralPanelsUiBinder.class);

	@UiField
	SimplePanel top;
	
	@UiField
	LayoutPanel workArea;
	
	@SuppressWarnings("unused")
	private Presenter presenter;

	public GeneralPanelsImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}
	
	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}

	@Override
	public void setTop(IsWidget topWidget) {
		top.setWidget(topWidget);
	}

	@Override
	public void setWorkArea(IsWidget workAreaWidget) {
		workArea.clear();
		workArea.add(workAreaWidget);
	}

	@Override
	public AcceptsOneWidget getWorkAreaForDisplay() {
		SimplePanel simplePanel = new SimplePanel();
		workArea.clear();
		workArea.add(simplePanel);
		return simplePanel;
	}
	
}
